package com.peanut.controller;

import com.peanut.common.Result;
import com.peanut.domain.bo.TabCarSeriesBO;
import com.peanut.server.impl.TabCarAgeimpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

@RestController
@RequestMapping("/shop")
public class ShopController {
    @Autowired
    private TabCarAgeimpl tabCarAgeimpl;


     //推荐服务V1
    @RequestMapping("/recommend")
    @ResponseBody
    public Result recommend(@RequestParam(name="longitude") BigDecimal longitude,
                            @RequestParam(name="latitude")BigDecimal latitude) throws Exception {
        if(longitude == null || latitude == null){
          return  Result.ERROR();
        }

        List<TabCarSeriesBO> shopList = tabCarAgeimpl.recommend(longitude,latitude);
             return  Result.OK().setData(shopList);
      }
}
